package com.dc2013.util;

import android.content.Context;
import android.content.SharedPreferences;

public class MyPreferences {

	private SharedPreferences mPref;
	private SharedPreferences.Editor mPrefEdit;
	
	private Context mContext;

	public MyPreferences(Context con, String prefs_ID)
	{
		mContext = con;
		
		mPref = mContext.getSharedPreferences(prefs_ID, 0);
		mPrefEdit = mPref.edit();
	}
	
	public void putMyPrefBoolean(String valName, boolean val)
	{
		mPrefEdit.putBoolean(valName, val);
		mPrefEdit.commit();
	}
	
	public void putMyPrefString(String valName, String val)
	{
		mPrefEdit.putString(valName, val);
		mPrefEdit.commit();
	}
	
	public void putMyPrefInt(String valName, int val)
	{
		mPrefEdit.putInt(valName, val);
		mPrefEdit.commit();
	}
	
	public boolean getMyPrefBoolean(String valName, boolean bDefault)
	{
		return mPref.getBoolean(valName, bDefault);
	}
	
	public String getMyPrefString(String valName, String szDefault)
	{
		return mPref.getString(valName, szDefault);
	}
	
	public int getMyPrefInt(String valName, int nDefault)
	{
		return mPref.getInt(valName, nDefault);
	}
	public void clear(String xml,Context context){
		mPrefEdit.clear();
		mPrefEdit.commit();
	}
}
